package com.ytzl.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class SecondServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //声明一个字符串
        String str="hello servlet!";
        //String str2="肉肉<br>肉肉";
        //响应对象找tomcat借一个流
        PrintWriter out = response.getWriter();
        out.print(str);//就可以把字符串说出到浏览器页面
        //out.print(str2);//就可以把字符串说出到浏览器页面
    }
}
